home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / opalvisn / dropshdw.lha / ScalePage.oprx < prev    next >
Text File  |  1993-04-29  |  2KB  |  70 lines

  1. /* Scales the current page proportionally.
  2.    AREXX script by Greg Nies, Centaur Development.
  3.  */
  4.  
  5. address 'OpalPaint_Rexx'
  6.  
  7. options Results
  8.  
  9. SaveSetUp
  10.  
  11. /* Ask for scale type */
  12.  
  13. AskInt 1 3 1 "Choose scaling method:\n1 = Percentage 2 = Scale to width  3 = Scale to height.\nAll methods will scale proportionally."
  14. If RC = 5 Then EXIT
  15. ScaleMethod = Result
  16.  
  17. /* Proportional gadget scaling */
  18.  
  19. If ScaleMethod = 1 Then Do
  20.     PageSize
  21.     parse var result Width Height
  22.     AskProp 0 100 50 "Current page size is "Width" x"Height".\nSelect scale percentage."
  23.     If RC = 5 Then EXIT
  24.     ScaleFactor = (Result/100)   /* Set scale percentage */
  25.     NewWidth = Trunc(Width*ScaleFactor)
  26.     NewHeight = Trunc(Height*ScaleFactor)
  27.     AskBool "New page size will be "NewWidth" x "NewHeight"."
  28.     If Result = 0 Then EXIT
  29.     PageSize NewWidth NewHeight
  30.     RestoreSetUp
  31.     EXIT
  32. End
  33.  
  34. /* Scale by reference to width */
  35.  
  36. If ScaleMethod = 2 Then Do
  37.     PageSize
  38.     parse var result Width Height
  39.     AskInt 1 Width Width "Current page size is "Width" x"Height".\nEnter new page width.\n(Height will be scaled proportionally.)"
  40.     If RC = 5 Then EXIT
  41.     NewWidth = Result
  42.     ScaleFactor = (Result/Width)   /* Set height scale percentage */
  43.     NewHeight = Trunc(Height*ScaleFactor)
  44.     AskBool "New page size will be "NewWidth" x "NewHeight"."
  45.     If Result = 0 Then EXIT
  46.     PageSize NewWidth NewHeight
  47.     RestoreSetUp
  48.     EXIT
  49. End
  50.  
  51. /* Scale by reference to height */
  52.  
  53. If ScaleMethod = 3 Then Do
  54.     PageSize
  55.     parse var result Width Height
  56.     AskInt 1 Height Height "Current page size is "Width" x"Height".\nEnter new page height.\n(Width will be scaled proportionally.)"
  57.     If RC = 5 Then EXIT
  58.     NewHeight = Result
  59.     ScaleFactor = (Result/Height)   /* Set width scale percentage */
  60.     NewWidth = Trunc(Width*ScaleFactor)
  61.     AskBool "New page size will be "NewWidth" x "NewHeight"."
  62.     If Result = 0 Then EXIT
  63.     PageSize NewWidth NewHeight
  64.     RestoreSetUp
  65.     EXIT
  66. End
  67.  
  68. RestoreSetUp
  69. EXIT
  70.